package com.sxy;

import com.sxy.config.SpringConfig;
import com.sxy.dao.BookDao;
import com.sxy.service.BookService;
import com.sxy.service.impl.BookServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author 宋鑫宇
 * @version 1.0
 */
public class AppForAnnotation {
    public static void main(String[] args) {
        //获取ioc容器
        ApplicationContext c = new AnnotationConfigApplicationContext(SpringConfig.class);
//        BookDao bookDao = (BookDao) c.getBean("bookDao");
//        bookDao.save();
        BookService bean = c.getBean(BookService.class);
        bean.save();
    }
}
